package com.shopping.auth.feign.factory;

import com.shopping.auth.feign.UserFeign;
import com.shopping.common.entity.vo.UserVo;
import com.shopping.common.result.Result;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class UserFeignFactory implements FallbackFactory<UserFeign> {

    @Override
    public UserFeign create(Throwable cause) {
        return new UserFeign() {
            // 查找用户
            @Override
            public Result<UserVo> findUserByUsername(String username) {
                return Result.error("网络错误");
            }

            // 注册用户
            @Override
            public Result<String> addUser(UserVo userVo) {
                return Result.error("网络错误");
            }
        };
    }
}
